home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Applications / NeuroSim 1.0 / .cp / CMyCaption.cp next >
Text File  |  1996-02-19  |  2KB  |  63 lines

  1. // ===========================================================================
  2. //    CMyCaption.cp                ©1995 Timo Eloranta
  3. // ===========================================================================
  4. //    A subclass of LCaption which uses TETextBox for drawing just like
  5. //  LCaption did before this changed in CW7...
  6.  
  7. #include "CMyCaption.h"
  8. #include <LStream.h>
  9. #include <UDrawingUtils.h>
  10. #include <UTextTraits.h>
  11.  
  12. #ifndef __TEXTUTILS__
  13. #include <TextUtils.h>
  14. #endif
  15.  
  16. // ---------------------------------------------------------------------------
  17. //        • CreateMyCaptionStream
  18. // ---------------------------------------------------------------------------
  19. //    Create a new CMyCaption object from the data in a Stream
  20.  
  21. CMyCaption*
  22. CMyCaption::CreateMyCaptionStream(
  23.     LStream    *inStream)
  24. {
  25.     return (new CMyCaption(inStream));
  26. }
  27.  
  28. // ---------------------------------------------------------------------------
  29. //        • CMyCaption(LStream*)
  30. // ---------------------------------------------------------------------------
  31. //    Construct from data in a Stream
  32.  
  33. CMyCaption::CMyCaption( LStream *inStream) 
  34.     : LCaption( inStream )
  35. {
  36. }
  37.  
  38. // ---------------------------------------------------------------------------
  39. //        • DrawSelf
  40. // ---------------------------------------------------------------------------
  41. //    Draw the Caption
  42.  
  43. void
  44. CMyCaption::DrawSelf()
  45. {
  46.     Rect    frame;
  47.     CalcLocalFrameRect(frame);
  48.     
  49.     Int16    just = UTextTraits::SetPortTextTraits(mTxtrID);
  50.     
  51.     RGBColor    textColor;
  52.     ::GetForeColor(&textColor);
  53.     
  54.     ApplyForeAndBackColors();
  55.     ::RGBForeColor(&textColor);
  56.  
  57.     // Next up is the difference between this class and LCaption.
  58.     // I use TETextBox just like LCaption did until this changed with CW7.
  59.     
  60.     ::TETextBox((Ptr)&mText[1], mText[0], &frame, just);
  61. //    UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0], frame, just);
  62. }
  63.